home *** CD-ROM | disk | FTP | other *** search
/ X User Tools / X User Tools (O'Reilly and Associates)(1994).ISO / sources / xpick / xpick_11.z / xpick_11 / xpick-1.1 / xapply < prev    next >
Text File  |  1993-06-21  |  569b  |  36 lines

  1. #!/bin/sh
  2.  
  3. #
  4. # xapply [-l] command
  5. #
  6. # apply command to files in current directory selected via xpick
  7. #
  8. # gerry.tomlinson@newcastle.ac.uk    June 1993
  9. #
  10.  
  11. case $1 in
  12. "-l")     LONG=TRUE; shift;;
  13. esac
  14.  
  15. case $# in
  16. 0)     echo usage: xapply [-l] command 
  17.     exit 1;;
  18. esac
  19.  
  20. cmnd=$*
  21. cmndargs=
  22.  
  23. XARGS='-xrm *ok.label:"$*" -xrm *ok.font:8x13bold -xrm *Command.font:8x13  -name xapply'
  24.  
  25.  
  26. case $LONG in
  27. TRUE)    cmndargs=`ls -l . | eval xpick $XARGS -1 - | awk '{print $8}'` ;;
  28. *)      cmndargs=`ls . | eval xpick $XARGS -`;;
  29. esac
  30.  
  31. case x$cmndargs in
  32. x)     ;;
  33. *)    eval $cmnd $cmndargs;;
  34. esac
  35.  
  36.